import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

//为了方便测试，此处用vuex做全局数据
const store = new Vuex.Store({
	state: {
		userInfo: {},
		isChangeShop:false,//是否更换店铺
		isLogin: false,
		orderType: 'takein',
		addresses: [],
		address: {},
		shop:{
			"id": 4,
			"name": "力明眼镜旗舰店",
			"address": "福建省福州市杨桥西路",
			"tel": "13599048945",
			"bessuniesTime":" 9:00--23:00",
			"latitude": "26.082181",
			"longitude": "119.272353",
			"distanceL":2.3
		},
		remark: '希望尽快配好'
	},
	mutations: {
		SET_ORDER_TYPE(state, orderType) {
			state.orderType = orderType
		},
		SET_ADDRESS(state, address) {
			state.address = address
		},
		SET_REMARK(state, remark) {
			state.remark = remark
		},
		SET_USERINFO(state, userInfo) {
			state.userInfo = userInfo
		},
		SET_ISLOGIN(state, isLogin) {
			state.isLogin = isLogin
		},
		SET_SHOP(state, shop) {
			state.shop = shop
		},
		SET_CHANGESHOP(state, flag) {
			state.isChangeShop = flag
		}
	}
})

export default store
